package main

import (
	"fmt"
	"runtime"
	"time"
)

func display2(str string) {
	for w := 0; w < 6; w++ {
		time.Sleep(1 * time.Second)
		fmt.Println(str)
	}
}

func main() {

	// 调用Goroutine
	go display2("Welcome")

	//调用普通函数
	display2("nhooo")

	cpu := runtime.NumCPU()
	fmt.Println("cpu========", cpu)

	runtime.GOMAXPROCS(cpu - 1)

	a := 9

	switch a {
	case 1:
		fmt.Printf("1")
	case 2:
		fmt.Printf("2")
	case 8:
		fmt.Printf("8")
	default:
		fmt.Printf("hello world")
	}
}
